[IA64] cleanup itir_ps(), itir_mask()
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Fri, 24 Feb 2006 15:28:36 +0000 (08:28 -0700)
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Fri, 24 Feb 2006 15:28:36 +0000 (08:28 -0700)
code clean up.
itir_ps(), itir_mask()

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
xen/arch/ia64/xen/process.c
xen/arch/ia64/xen/vcpu.c
xen/include/asm-ia64/vcpu.h

index 249b5e93b634797927a8cef7a1012614587eddc7..8e9d1e815824de10fa633fb5212c35bfbd74d993 100644 (file)
@@ -94,7 +94,7 @@ unsigned long translate_domain_pte(unsigned long pteval,
        extern unsigned long dom0_start, dom0_size;
 
        // FIXME address had better be pre-validated on insert
-       mask = (1L << ((itir >> 2) & 0x3f)) - 1;
+       mask = itir_mask(itir);
        mpaddr = ((pteval & _PAGE_PPN_MASK) & ~mask) | (address & mask);
        if (d == dom0) {
                if (mpaddr < dom0_start || mpaddr >= dom0_start + dom0_size) {
index a15b09981a73bbb0513c3908f91f8f3d1dcce764..508383b92b6eac4cb9a1f6e49b2b5a8269e70338 100644 (file)
@@ -1293,9 +1293,6 @@ IA64FAULT vcpu_ttag(VCPU *vcpu, UINT64 vadr, UINT64 *padr)
        return (IA64_ILLOP_FAULT);
 }
 
-#define itir_ps(itir)  ((itir >> 2) & 0x3f)
-#define itir_mask(itir) (~((1UL << itir_ps(itir)) - 1))
-
 unsigned long vhpt_translate_count = 0;
 unsigned long fast_vhpt_translate_count = 0;
 unsigned long recover_to_page_fault_count = 0;
@@ -1798,7 +1795,7 @@ void vcpu_itc_no_srlz(VCPU *vcpu, UINT64 IorD, UINT64 vaddr, UINT64 pte, UINT64
 
 IA64FAULT vcpu_itc_d(VCPU *vcpu, UINT64 pte, UINT64 itir, UINT64 ifa)
 {
-       unsigned long pteval, logps = (itir >> 2) & 0x3f;
+       unsigned long pteval, logps = itir_ps(itir);
        unsigned long translate_domain_pte(UINT64,UINT64,UINT64);
        BOOLEAN swap_rr0 = (!(ifa>>61) && PSCB(vcpu,metaphysical_mode));
 
@@ -1818,7 +1815,7 @@ IA64FAULT vcpu_itc_d(VCPU *vcpu, UINT64 pte, UINT64 itir, UINT64 ifa)
 
 IA64FAULT vcpu_itc_i(VCPU *vcpu, UINT64 pte, UINT64 itir, UINT64 ifa)
 {
-       unsigned long pteval, logps = (itir >> 2) & 0x3f;
+       unsigned long pteval, logps = itir_ps(itir);
        unsigned long translate_domain_pte(UINT64,UINT64,UINT64);
        BOOLEAN swap_rr0 = (!(ifa>>61) && PSCB(vcpu,metaphysical_mode));
 
index 18ec988891cf9a2008a4497fe97f2b99d0487ac2..492a759ea524b50794733a76fe9e22057ffd80ab 100644 (file)
@@ -149,4 +149,16 @@ extern void vcpu_itc_no_srlz(VCPU *vcpu, UINT64, UINT64, UINT64, UINT64, UINT64)
 extern UINT64 vcpu_get_tmp(VCPU *, UINT64);
 extern void vcpu_set_tmp(VCPU *, UINT64, UINT64);
 
+static inline UINT64
+itir_ps(UINT64 itir)
+{
+    return ((itir >> 2) & 0x3f);
+}
+
+static inline UINT64
+itir_mask(UINT64 itir)
+{
+    return (~((1UL << itir_ps(itir)) - 1));
+}
+
 #endif